package com.zany.children.dao;

import com.zany.children.vo.Class;
import com.zany.children.vo.Student;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import java.util.List;

public class ClassDaoImpl extends SqlMapClientDaoSupport implements  ClassDao {


    @Override
    public List<Class> getClassListPage(Class clazz) {
        List list = getSqlMapClientTemplate().queryForList("class.getClassListPage", clazz);
        return list;
    }

    @Override
    public Integer getClassListPageCount(Class clazz) {
        Integer count = (Integer) getSqlMapClientTemplate().queryForObject("class.getClassListPageCount", clazz);
        return count;
    }

    @Override
    public Long saveClass(Class clazz) {
        Long insert = (Long)getSqlMapClientTemplate().insert("class.insertClass", clazz);
        return insert;
    }

    @Override
    public void updateClass(Class clazz) {
        getSqlMapClientTemplate().update("class.updateClass",clazz);
    }

    @Override
    public Class getClassById(Long id) {
        Class clazz =(Class) getSqlMapClientTemplate().queryForObject("class.getClassById", id);
        return clazz;
    }

    @Override
    public void deleteClassById(Long id) {
        getSqlMapClientTemplate().update("class.deleteClassById",id);
    }
}
